﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SES.CMS.BL;
using SES.CMS.DO;

namespace SES.CMS.Module
{
    public partial class ucCateMarquee : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = Request.Url.AbsolutePath;
            url = url.Substring(1, url.Length - 1);
            string url1 = url.Replace(".", "/");
            string Module = url1.Substring(0, url1.IndexOf("/"));
            if(Module == "About")
            {
                if(!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    rptLoadImagesOfCategory(int.Parse(Request.QueryString["ID"].ToString()));
                }
            }
            else if (Module == "Article")
            {
                if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    rptLoadImagesOfArticle(int.Parse(Request.QueryString["ID"].ToString()));
                }
            
            }
        }

        //protected void rptSlideHomepageDataSource()
        //{
        //    rptSlideHomepage.DataSource = new cmsImagesBL().SelectBySlideID(1);
        //    rptSlideHomepage.DataBind();
        //}

        protected void rptLoadImagesOfCategory(int categoryID)
        {
            rptSlideHomepage.DataSource = new cmsImagesBL().SelectByCategoryID(categoryID);
            rptSlideHomepage.DataBind();
        }
        protected void rptLoadImagesOfArticle(int articleID)
        {
            rptSlideHomepage.DataSource = new cmsImagesBL().SelectByArticleID(articleID);
            rptSlideHomepage.DataBind();
        }
    }
}